//
//  xiangqinItems.m
//  lyxluyou
//
//  Created by mmyy on 15/10/16.
//  Copyright (c) 2015年 mmyy. All rights reserved.
//

#import "xiangqinItems.h"

@implementation xiangqinItems
+(instancetype)xiangqinItemsWithDict:(NSDictionary *)dict
{
    xiangqinItems *items = [xiangqinItems new];
    items.waypoint = [NSMutableArray arrayWithCapacity:0];
    NSDictionary *trip = [dict objectForKey:@"trip"];
    items.datetime = trip[@"datetime"];
    items.vid = trip[@"id"];
    items.name = trip[@"name"];
    items.uid = [[trip objectForKey:@"user"] objectForKey:@"id"];
    items.uname = [[trip objectForKey:@"user"] objectForKey:@"name"];
    items.avatar_m = [[trip objectForKey:@"user"] objectForKey:@"avatar_m"];
    items.trip_text = dict[@"trip_text"];
    NSArray *waypoints = [dict objectForKey:@"waypoints"];
    for (NSDictionary *itm in waypoints) {
        [items.waypoint addObject:[itm objectForKey:@"photo_s"]];
    }
    return items;
}
@end
